<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/12 0012
 * Time: 下午 2:47
 */
namespace app\admin\controller;
use app\api\service\Order;
use app\common\BaseHelper;
use think\Cache;
use think\Controller;
use app\lib\Helper;
use app\admin\model\Test as TestModel;
use app\admin\model\Tenant;
use think\Db;
use think\Response;
use app\common\DictConstant;

class Test extends Controller
{
    private function editOrderStatus($order_status){
        /*
         * 达达订单状态
         const status_1 = 1; //订单状态(待接单＝1
         const status_2 = 2; // 待取货＝2
         const status_3 = 3; // 配送中＝3
         const status_4 = 4; // 已完成＝4
         const status_5 = 5; // 已取消＝5
         const status_7 = 7; // 已过期=7
         const status_8 = 8; // 指派单=8
         const status_9 = 9; // 妥投异常之物品返回中=9
         const status_10 = 10; // 妥投异常之物品返回完成=10
         const status_1000 = 1000; // 创建达达运单失败=1000
         order订单状态
         订单状态
         1=待付款，
         2=待发货，
         3=待收货，
         4=已完成，
         5=已失效，
         6=售后，
         7=已消费，
         8=未消费，
         9=拼团中，
         10=同意售后退款，
         11=拒绝售后退款,
         12=待接单/已派送,
         13=已取消*/
        $orderModel = new \app\common\model\Order();
        switch ($order_status){
            case 1:
                $status = $orderModel::STATUS_12;
                break;
            case 2:
                $status = $orderModel::STATUS_PENDING_DELIVERY;
                break;
            case 3:
                $status = $orderModel::STATUS_3;
                break;
            case 4:
                $status = $orderModel::STATUS_4;
                break;
            case 5:
                $status = $orderModel::STATUS_13;
                break;
            case 7:
                $status = $orderModel::STATUS_5;
                break;
            case 8:
                $status = $orderModel::STATUS_PENDING_DELIVERY;
                break;
            case 9:
                $status = $orderModel::STATUS_PENDING_DELIVERY;
                break;
            case 10:
                $status = $orderModel::STATUS_PENDING_DELIVERY;
                break;
            case 1000:
                $status = $orderModel::STATUS_5;
        }
        return $status;
    }

    public function index(){
        $status = $this->editOrderStatus(10);
        dump($status);
    }
}